package com.qf.test;

import org.apache.log4j.helpers.ThreadLocalMap;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * User: key
 * ClassName:NewThread
 * Date: 2023/5/29
 * Time: 10:01
 * description:
 */
public class NewThread implements Callable<String> {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<String> task = new FutureTask<>(new NewThread());
        Thread thread = new Thread(task);
        thread.start();
        String result = task.get();
        System.out.println(result);
    }
    @Override
    public String call() throws Exception {
        return "Hello World";
    }
}
